//
//  ViewController.m
//  手势解码
//
//  Created by wangcarl on 16/8/4.
//  Copyright © 2016年 wangcarl. All rights reserved.
//

#import "ViewController.h"
#import "UnlockVIew.h"

@interface ViewController ()<UnlockDelegate>
@property (weak, nonatomic) IBOutlet UIImageView *imageView;

@property (weak, nonatomic) IBOutlet UnlockVIew *unlockView;
@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor=[UIColor colorWithPatternImage:[UIImage imageNamed:@"Home_refresh_bg"]];
    self.unlockView.delegate=self;
    // Do any additional setup after loading the view, typically from a nib.
}

- (void)UnLockView:(UnlockVIew *)unLockView withPwd:(NSString *)pwdStr
{
    UIGraphicsBeginImageContextWithOptions(unLockView.bounds.size, NO, 0.0);
    CGContextRef ctx=UIGraphicsGetCurrentContext();
    [unLockView.layer renderInContext:ctx];
    UIImage *getImage=UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    UIImageWriteToSavedPhotosAlbum(getImage, self, nil, nil);
    self.imageView.image=getImage;
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
